/*--------------------------------------------------------------
 * File: demo61.c 编码类型：C语言  UTF-8
 * Author WRS (1352509846@qq.com)
 * 功能: 字符串排序
 * Version 0.1
 * Date 2022-09-11 
 * 
 * @copyright Copyright (c) 2022
 * 
----------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[])
{
    int i, j;
    char str[10][50] = {0};
    char temp[50];

    printf("请输入10个单词：\n");
    for(i=0; i<10; i++)
    {
        scanf("%s[^\n]",str[i]);
    }

    for(i=0; i<9; i++)
    {
        for(j=i+1; j<10; j++)
        {
            if(strcmp(str[i], str[j]) > 0)
            {
                strcpy(temp, str[i]);
                strcpy(str[i], str[j]);
                strcpy(str[j], temp);
            }
        }
    }

    printf("\n排序后:\n");
    for(i=0; i<10; i++)
    {
        puts(str[i]);
    }
    return 0;
}

